package thn.glf.org.personalfinancial;

import thn.glf.org.personalfinancial.objData.Setting;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class Main extends Activity {
	public static int ngayketso = 1;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		Button btnMoneyOfSetting = (Button) findViewById(R.id.btnSetting);
		btnMoneyOfSetting.setOnClickListener(Setting_Click);
		Button btnMoneyOfYear = (Button) findViewById(R.id.btnMoneyOfYear);
		btnMoneyOfYear.setOnClickListener(MoneyOfYear_Click);
		Button btnMoneyOfMonth = (Button) findViewById(R.id.btnMoneyOfMonth);
		btnMoneyOfMonth.setOnClickListener(MoneyOfMonth_Click);
		Button btnMoneyOfDay = (Button) findViewById(R.id.btnMoneyOfDay);
		btnMoneyOfDay.setOnClickListener(MoneyOfDay_Click);
		Setting setting=new Setting();
		setting.setmContext(this);		
		Main.ngayketso=setting.getList().get(0).getDay();
	}

	private OnClickListener MoneyOfDay_Click = new OnClickListener() {

		@Override
		public void onClick(View v) {
			// TODO Auto-generated method stub
			Intent i = new Intent(Main.this, MoneyOfDayListActivity.class);
			startActivity(i);
		}
	};
	private OnClickListener MoneyOfMonth_Click = new OnClickListener() {

		@Override
		public void onClick(View v) {
			// TODO Auto-generated method stub
			Intent i = new Intent(Main.this, MoneyOfMonthActivity.class);
			startActivity(i);
		}
	};
	private OnClickListener MoneyOfYear_Click = new OnClickListener() {

		@Override
		public void onClick(View v) {
			// TODO Auto-generated method stub
			Intent i = new Intent(Main.this, MoneyOfYearActivity.class);
			startActivity(i);
		}
	};
	private OnClickListener Setting_Click = new OnClickListener() {

		@Override
		public void onClick(View v) {
			// TODO Auto-generated method stub
			Intent i = new Intent(Main.this, SettingActivity.class);
			startActivity(i);
		}
	};

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}
	protected void onResume() {
		super.onResume();
		Setting setting=new Setting();
		setting.setmContext(this);		
		Main.ngayketso=setting.getList().get(0).getDay();
}
}
